Skip to content

Add Repo.transact/2 and soft-deprecate transaction/2#4618

Merged
wojtekmach merged 1 commit into
masterfrom
wm-transact
Jun 11, 2025
Merged

Add Repo.transact/2 and soft-deprecate transaction/2#4618
wojtekmach merged 1 commit into
masterfrom
wm-transact

Conversation

@wojtekmach

Copy link
Copy Markdown
Member

No description provided.

Comment thread lib/ecto/repo/transaction.ex
@wojtekmach
wojtekmach merged commit c87024c into master Jun 11, 2025
13 of 14 checks passed
@wojtekmach
wojtekmach deleted the wm-transact branch June 11, 2025 17:35
@dustinfarris

Copy link
Copy Markdown
Contributor

Is the motivation for this documented anywhere? Trying to get up to speed.

@wojtekmach

Copy link
Copy Markdown
Member Author

Please see PR description in #4577 (comment)

@warmwaffles

warmwaffles commented Jul 14, 2025

Copy link
Copy Markdown
Member

@wojtekmach probably wise to link to the original PR in the body or just copy paste the old PR description here for the next casual passer-by skimming.

@Nezteb

Nezteb commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

@warmwaffles here's a copy-paste of that PR description: (since I can't edit the original 😄)

References:

I believe the interface and implementation are fairly uncontroversial and straightforward. I think the bigger undertaking is potentially revamping the docs, de-emphasizing Multi in favor of this, given that in a lot of (if not the vast majority of) cases, it achieves the same outcomes with less and simpler code. There are no plans to deprecate Multi.

The name of this function is not ideal, some other options considered were Repo.transact and Repo.with_transaction. I think Repo.transaction_with wins because basically:

iex(1)> Repo.transaction<tab>
transaction/1         transaction/2         transaction_with/1    transaction_with/2

That is, it will show up alongside transaction in docs, autocomplete, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants